package com.spring.forum.config;

import com.spring.forum.model.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@Slf4j
@ResponseBody
@ControllerAdvice
public class ExceptionHandle {

    @ExceptionHandler()
    public Result exceptionHandle(Exception e) {
        log.error("异常信息：", e);
        return Result.errorNoData("出错了，请稍后再试");
    }
}
